package cn.wubo.vrr.help.service.impl;

import cn.wubo.vrr.help.entity.Education;
import cn.wubo.vrr.help.entity.Family;
import cn.wubo.vrr.help.repository.FamilyRepo;
import cn.wubo.vrr.help.service.FamilyService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.data.domain.Example;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class FamilyServiceImpl implements FamilyService {
    @Autowired
    FamilyRepo familyRepo;

    @Override
    public List<Family> saveOrUpdateAll(List<Family> list) {
        if (list.size() > 0) {
            Family query = new Family();
            query.setEMPLID(list.get(0).getEMPLID());
            familyRepo.deleteAll(familyRepo.findAll(Example.of(query)));
            list = familyRepo.saveAll(list);
        }
        return list;
    }
}
